package scalab.core.gates

import component.{Component, SinkComponent}


trait MandatoryInput extends Input{
	private[core] def lackMessage: String = "Mandatory Input lacks source!"
	/*final override private[core] def validate(validated: Set[Buildable]): Pair[Boolean, Set[Buildable]] = {
		component.debug("out.validate")
		if(providers.isEmpty){
			component.fail(lackMessage)
			(false, validated)
		}
		else
			super.validate(validated)
	}*/

	final override private[core] def validate(
		visited: Set[Component], 
		cycles: Set[(Output, Input)], 
		validated: Set[SinkComponent]): (
			Boolean, 
			Set[Component], 
			Set[(Output, Input)], 
			Set[SinkComponent]
		) = {
			if(providers.isEmpty){
				component.fail(lackMessage)
				(false, visited, cycles, validated)
			}
			else
				super.validate(visited, cycles, validated)
		}
}
